/*
 *  Copyright (C) 2011 felixtheripper <felixtheripper_AT_gmail.com>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
/**
 *
 * @author felixtheripper
 *
 * email: felixtheripper_AT_gmail.com
 * ... please remove "_AT_" from the above string to get the right email address
 *
 */

package org.myorg.shr.gui.swg.display.button;

import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.Action;
import javax.swing.JButton;
import org.myorg.shr.gui.swg.lang.IShrObj;

public class BtnAbs extends JButton implements
	IShrObj,
	MouseListener
{

	// ---------
	// protected

    private void makeModif(){
        super.setBorderPainted(false);
        super.setContentAreaFilled(false);
        super.addMouseListener(this);
    }


    public BtnAbs(Action act)
    {
        super(act);
        this.makeModif();
    }

    protected BtnAbs(String strText) {
        super(strText);
    }

    protected BtnAbs(String strText, javax.swing.ImageIcon iin) {
        super(strText, iin);
    }

    protected BtnAbs(ActionListener[] alrs, String strToolTipText) {
        super();
        if (alrs != null) {
                for (int i=0; i<alrs.length; i++){
                        if (alrs[i] != null)
                                super.addActionListener(alrs[i]);
                }
        }
        if (strToolTipText != null){
                super.setToolTipText(strToolTipText);
        }
        this.makeModif();
    }

    protected BtnAbs(Action act, String strToolTipText){
        super(act);

        if (strToolTipText != null)
            super.setToolTipText(strToolTipText);

        this.makeModif();
    }

    protected BtnAbs(Action act, String strToolTipText, String strText, javax.swing.ImageIcon iin) {
        super(strText, iin);
        super.setAction(act);
        if (strToolTipText != null){
            super.setToolTipText(strToolTipText);
        }
        this.makeModif();

    }

    protected BtnAbs(ActionListener alr, String strToolTipText){
        super();

        if (alr != null)
                super.addActionListener(alr);

        if (strToolTipText != null)
                super.setToolTipText(strToolTipText);

        super.setBorderPainted(false);
        super.setContentAreaFilled(false);
        super.addMouseListener(this);
    }

    protected BtnAbs(
            String strText,
            String strToolTip,
            ActionListener actListenerParent)
    {
        this(strText, strToolTip);
        this._actListenerParent_ = actListenerParent;

        if (this._actListenerParent_ != null)
            addActionListener(this._actListenerParent_);
    }

    protected BtnAbs(String strText, String strToolTip){
        super();

        if (strText != null)
            setText(strText);

        if (strToolTip != null)
            setToolTipText(strToolTip);
    }

    protected BtnAbs(){
        super();
        this.setSize(75, 24);

    }

        @Override
    public void mouseReleased(MouseEvent evtMouse) {}

    @Override
    public void mousePressed(MouseEvent evtMouse) {}

    @Override
    public void mouseClicked(MouseEvent evtMouse) {}

    @Override
    public void mouseEntered(MouseEvent evtMouse)
    {
        if (isEnabled())
        {
            setBorderPainted(true);
            setContentAreaFilled(true);
        }
    }

    @Override
    public void mouseExited(MouseEvent evtMouse)
    {
        setBorderPainted(false);
        setContentAreaFilled(false);
    }

    @Override
    public void destroy()
    {
    	super.removeMouseListener(this);
    }

    @Override
    public boolean init() { return true; }

    
    private static final long _SERIAL_VERSION_UID_ = 1L;
    private ActionListener _actListenerParent_ = null;

}
